package controllers

import (
	"WebSvr/modules/common"
	"fmt"

	"github.com/astaxie/beego"
)

func RecordUserAction(username string, access int, strIP string, action string) {
	var str string
	switch int32(access) {
	case common.ACCESS_ADMIN:
		{
			str = fmt.Sprintf("已登录用户:%v在ip:%v 操作:%v 权限:common.ACCESS_ADMIN", username, strIP, action)
		}
	case common.ACCESS_SERVER:
		{
			str = fmt.Sprintf("已登录用户:%v在ip:%v 操作:%v 权限:common.ACCESS_SERVER", username, strIP, action)
		}
	case common.ACCESS_REPORT:
		{
			str = fmt.Sprintf("只读用户:%v在ip:%v 操作:%v 权限:common.ACCESS_REPORT", username, strIP, action)
		}
	default:
		{
			str = fmt.Sprintf("未知用户在ip:%v 操作:%v 权限:无!!", strIP, action)
		}
	}
	beego.Info(str)
}
